import App from "@/App";
import Home from "@/views/Home";
import About from "@/views/About";

import { BrowserRouter, Routes, Route,Navigate } from "react-router-dom";
// history模式 (BrowserRouter)
// hash模式(HashRouter)

// 简写
const baseRouter = () => {
  return (
    <BrowserRouter>
      <Routes>
        <Route path="/" element={<App />}>
          {/* 配置用户访问/ 时重定向到home */}
          <Route path="/" element={<Navigate to="/home"/>}></Route>
          <Route path="/home" element={<Home />}></Route>
          <Route path="/about" element={<About />}></Route>
        </Route>
      </Routes>
    </BrowserRouter>
  );
};

export default baseRouter;
